import java.util.Scanner;

public class Main {

    //求和

    //给定 n 个整数，求它们两两相乘再相加的和

//    public static final int N = 1010;
//    public static int n;
//    public static int[] sum = new int[N];
//
//    public static void main1(String[] args) {
//        Scanner scan = new Scanner(System.in);
//        n = scan.nextInt();
//        int[] a = new int[N];
//        for (int i = 1; i <= n ; i++) {
//            a[i] = scan.nextInt();
//            sum[i] = sum[i - 1]*a[i];
//        }
//        System.out.println(getSum());
//    }
//
//    private static long getSum() {
//        long ret = 0;
//        for (int i = 1; i <= n ; i++) {
//            for (int j = i; j <= n ; j++) {
//                ret += (long)sum[j] * sum[i - 1];
//            }
//        }
//        return ret;
//    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n + 1];
        long ans = 0;
        int sum = 0;

        // 4
        // 1 3 6 9

        for (int i = 1; i <= n ; i++) {
            a[i] = scan.nextInt();
            ans += (long)a[i]*sum;
            sum += a[i];
        }
        System.out.println(ans);
    }


}
